package acceptancetest;

public class Test1 {
    public static void main(String[] args) {
        ///匿名内部类
        Object o = new Object(){
            @Override
            public boolean equals(Object obj) {
                return true;
            }
        };
        System.out.println(o.equals("Fred"));


        Test1 test1 = new Test1(){
            @Override
            public void func() {
                System.out.println("我是重写的func");
            }
        };
        test1.func();
        Test1 test3 = test1;
        test3.func();
        Test1 test2 = new Test1();
        test2.func();
    }

    public void func() {
        System.out.println("我是原本的func");
        new Test1(){
            @Override
            public void func() {
                System.out.println("我是func方法中的匿名内部类");
            }
        }.func();
    }
}
